package com.neusoft.controller.physician;

import com.neusoft.bean.PageBean;
import com.neusoft.service.MedicalRecordService;
import com.neusoft.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/physician")
public class PhysicianHistoryController {
    @Autowired
    private RegisterService registerService;
    @Autowired
    private MedicalRecordService medicalRecordService;

    @GetMapping("/getWaitPatient")
    public PageBean getWaitPatient(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "5") Integer pageSize,
            String caseNumber,
            String realName) {
        return registerService.getPatient(page, pageSize, caseNumber, realName);
    }


    @RequestMapping("/getMedicalRecord")
    public Map<String, Object> getMedicalRecord(String id) {
        return medicalRecordService.selectMedicalRecord(id);
    }


    @PostMapping("/updateMedicalRecord")
    public String updateMedicalRecord(@RequestBody Map<String,Object> map){
        return medicalRecordService.updateMedicalRecord(map);
    }
}
